package com.xz.example2;

import com.xz.example2.builder.ActorBuilder;
import com.xz.example2.director.ActorController;
import com.xz.example2.model.Actor;
import com.xz.example2.util.XMLUtil;

/**
 * @author 张志航     
 * @version V1.0.0
 * @projectName design_mode
 * @title     Client   
 * @package    com.xz.example  
 * @date   2019/11/27 18:38  
 * @explain
 */
public class Client {

    /**
     * 优化：
     *      忽略指挥者（ActorController），引入钩子方法
     * @param args
     */
    public static void main(String[] args) {

        Object bean = XMLUtil.getBean();
        if (null != bean && bean instanceof ActorBuilder){
            ActorBuilder builder = (ActorBuilder) bean;
            Actor actor = builder.construct();
            System.out.println(actor.getType()+"的外观：");
            System.out.println("属性："+actor.getSex());
            System.out.println("面容："+actor.getFace());
            System.out.println("发型："+actor.getHairstyle());
            System.out.println("服饰："+actor.getCostume());
        }
    }

}
